﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

//游戏控制器，控制射击距离、重力、风量等参数;
public class GameController : MonoBehaviour
{
    //系统状态面板
    public Text systemPanel;
    string text;
    //射击距离
    public Slider distanceSlider;
    //子弹速度
    public Slider speedSlider;
    //重力系数
    public Slider gravitySlider;
    //风力系数（整数为向右，复数为向左，0为无风）
    public Slider windSlider;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        text += "当前系统参数";
        text += "\n射击距离："+getShootDistance();
        text += "\n子弹速度：" + getBulletSpeed();
        text += "\n重力系数：" + getGravityCoefficient();
        text += "\n风力系数：" + getWindCoefficient();
        systemPanel.text = this.text;
        systemPanel.text.Replace("\\n", "\n");
        this.text = "";
    }

    //获取重力系数
    public float getGravityCoefficient() {
        return gravitySlider.value;
    }
    //获取风力系数
    public float getWindCoefficient() {
        return windSlider.value;
    }
    //获取弹速
    public float getBulletSpeed()
    {
        return speedSlider.value * 100;
    }
    //获取射击距离
    public float getShootDistance()
    {
        return distanceSlider.value * 100;
    }
}
